package pl.makimo.fuzzy.linguistics;

import java.util.ArrayList;
import java.util.List;

import pl.makimo.fuzzy.sets.ContinuousFuzzySet;
import pl.makimo.fuzzy.sets.FuzzySet;

public class Summarizer<T> {
	public String label;
	public String variable;
	public FuzzySet<T> set;
	
	public List<Summarizer<T>> getSingleSummarizers() {
		List<Summarizer<T>> summarizers = new ArrayList<Summarizer<T>>();
		summarizers.add(this);
		return summarizers;
	}
	
	@Override
	public String toString() {
		return label + " " + variable;
	}
	
	public static <E> Summarizer<E> fromLinguisticVariable(LinguisticVariable<E> variable, String label) {
		FuzzySet<E> set = variable.labels.get(label);
		
		Summarizer<E> summarizer = new Summarizer<E>();
		summarizer.set = set;
		summarizer.label = label;
		summarizer.variable = variable.name;
		
		return summarizer;
	}
}
